<template>
<div>
  <div>
    <div class="container">
      <div class="handle-box">

        <el-row>
          <!--<el-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4">
            <el-input v-model="examKeyWord"  placeholder="请输入查询关键字" class="handle-input mr10 searchLabel"/>
          </el-col>
          <el-col :xs="8" :sm="8" :md="8" :lg="8" :xl="8">
            <el-button class="searchButton" type="primary"icon="el-icon-search" @click="handleSearch(examKeyWord)">搜索</el-button>
          </el-col>-->
          <el-col :xs="1" :sm="1" :md="1" :lg="1" :xl="1">
            <el-button type="primary" icon="el-icon-plus" class="handle-del mr10 exam_create" @click="$router.push({path:'/paperCreate'})">发布考试
            </el-button>
          </el-col >

        </el-row>

      </div>
      <el-table :data="tableData"  border class="table" ref="multipleTable" header-cell-class-name="table-header"
                highlight-current-row>
        <el-table-column prop="exampageId" label="考试编号" min-width="60" align="center"/>
        <el-table-column prop="exampageName" label="试卷名称" min-width="150"/>
        <el-table-column prop="startTime" label="开始时间" min-width="110" align="center"/>
        <el-table-column prop="endTime" label="结束时间" min-width="110" align="center"/>
        <el-table-column prop="adviceTime" label="建议时长" min-width="60" align="center"/>
        <el-table-column prop="count" label="考试人数" min-width="60" align="center"/>
        <el-table-column label="考试状态" min-width="70" align="center">
          <template slot-scope="{row}">
            <el-tag :type="statusTagFormat(row)">
              {{ statusFormat(row)}}
            </el-tag>
          </template>
        </el-table-column>



        <el-table-column label="操作" min-width="200" align="center" fixed="right">
          <template slot-scope="scope">
            <el-button type="text" class="editButton" icon="el-icon-edit" :disabled="(test(scope.row) === 2) || (test(scope.row) === 1)"  @click="editPaper(scope.row.exampageId)">试卷编辑
            </el-button>
            <el-button type="text" class="editButton" icon="el-icon-s-custom" :disabled="(test(scope.row) === 2) || (test(scope.row) === 1)"  @click="addUser(scope.row.exampageId)">选择考生
            </el-button>
            <el-button type="text"  icon="el-icon-document-copy" class="deleteButton" @click="examInfo(scope.row)">考试详情
            </el-button>

            <el-button type="text"  icon="el-icon-delete" :class="test(scope.row) !== 1 ? 'red': ''" class="deleteButton" :disabled="(test(scope.row) === 1)" @click="deleteExam(scope.row.exampageId)">删除
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination background layout="total, prev, pager, next" :current-page="queryExam.currentPage"
                       :page-size="queryExam.pageSize" :total="queryExam.total" @current-change="handleExamChange"/>
      </div>
    </div>

    <!-- 编辑试卷弹出框 -->
    <el-dialog title="编辑试卷" :visible.sync="editPaperVisible" width="50%">
      <el-scrollbar style="height: 600px">
        <div class="app_container">

          <div class="container_header">
            <div class="right_container_header_div1">{{form.examPageName}}</div>
            <div class="right_container_header_div2">{{'时长:' + form.adviceTime + '分钟'}}</div>
            <div class="right_container_header_div3">{{'总分:' + getTotal()}}</div>
          </div>

          <div class="right_container_body">
            <!-- 选择题渲染 -->
            <div class="right_container_body_choice">
              <div class="right_container_body_choice_div1">
                <span style="font-size: 20px">单选题</span>
                <el-button type="text" class="addQuestion" @click="addChoice">添加题目</el-button>
              </div>

              <div class="right_container_body_choice_div2">
                <div v-for="(item,index) in form.choice" :key="index" class="right_container_body_choice_div3">
                  <div class="right_container_body_choice_div4">
                    <div class="right_container_body_choice_div5">{{(index + 1) + '.'}}</div>
                    <div v-html="item.title" class="right_container_body_choice_div6"></div>
                    <el-button type="text" class="right_container_body_choice_set" @click="handleChoiceSet(item.id)">设置分数
                    </el-button>
                    <el-button type="text" class="right_container_body_choice_delete" @click="deleteChoice(index)">删除
                    </el-button>
                  </div>

                  <div class="right_container_body_choice_div7">
                    <div v-for="(it,ide) in item.items" :key="ide" class="right_container_body_choice_div8">
                      <span class="fontHeight">{{it.prefix+'.'}}</span><span v-html="it.content"
                                                                             class="fontHeight"></span>
                    </div>
                  </div>

                  <div style="display: flex;margin-top: 1%">
                    <div class="fontHeight">{{'解析:'}}</div>
                    <div v-html="item.analyze" class="fontHeight"></div>
                  </div>

                  <div style="margin-top: 1%;height: 20px;line-height: 20px">{{'分数:' + item.score}}</div>
                  <div style="margin-top: 1%;height: 20px;line-height: 20px">{{'答案:' + item.correctArray}}</div>
                </div>
              </div>
            </div>

            <!-- 多选题渲染 -->
            <div class="right_container_body_multChoices">
              <div class="right_container_body_choice_div1">
                <span style="font-size: 20px">多选题</span>
                <el-button type="text" class="addQuestion" @click="addMultChoices">添加题目</el-button>
              </div>
              <div class="right_container_body_choice_div2">
                <div v-for="(item,index) in form.multChoices" :key="index" style="padding-top: 3%">
                  <div style="display: flex">
                    <div class="right_container_body_choice_div5">{{(index + 1) + '.'}}</div>
                    <div v-html="item.title" class="right_container_body_choice_div5"></div>
                    <el-button type="text" class="right_container_body_choice_set" @click="handleChoiceSet(item.id)">设置分数</el-button>
                    <el-button type="text" class="right_container_body_choice_delete" @click="deleteMutiChoices(index)">
                      删除
                    </el-button>
                  </div>

                  <div style="margin-left: 2%;padding-bottom: 1%;margin-top: 2%;width: 100%;display: flex;">
                    <div v-for="(it,ide) in item.items" :key="ide" style="width: 25%;display: flex">
                      <span class="fontHeight">{{it.prefix+'.'}}</span><span v-html="it.content"
                                                                             class="fontHeight"></span>
                    </div>
                  </div>

                  <div style="display: flex;margin-top: 2%">
                    <div class="fontHeight">{{'解析:'}}</div>
                    <div v-html="item.analyze" class="fontHeight"></div>
                  </div>

                  <div style="margin-top: 1%;height: 20px;line-height: 20px">{{'分数:' + item.score}}</div>
                  <div style="margin-top: 1%;height: 20px;line-height: 20px">{{'答案:' + item.correctArray}}</div>
                </div>
              </div>


            </div>

            <!-- 判断题渲染 -->
            <div class="right_container_body_judge">
              <div class="right_container_body_choice_div1">
                <span style="font-size: 20px">判断题</span>
                <el-button type="text" class="addQuestion" @click="addJudge">添加题目</el-button>
              </div>
              <div class="right_container_body_choice_div2">
                <div v-for="(item,index) in form.judge" :key="index" style="padding-top: 3%">
                  <div style="display: flex">
                    <div class="right_container_body_choice_div5">{{(index + 1) + '.'}}</div>
                    <div v-html="item.title" class="right_container_body_choice_div5"></div>
                    <el-button type="text" class="right_container_body_choice_set" @click="handleChoiceSet(item.id)">设置分数</el-button>

                    <el-button type="text" class="right_container_body_choice_delete" @click="deleteJudge(index)">删除
                    </el-button>
                  </div>

                  <div style="margin-left: 2%;padding-bottom: 1%;margin-top: 2%;width: 100%;display: flex;">
                    <div v-for="(it,ide) in item.items" :key="ide" style="width: 25%;display: flex">
                      <span class="fontHeight">{{it.prefix+'.'}}</span><span v-html="it.content"
                                                                             class="fontHeight"></span>
                    </div>
                  </div>

                  <div style="display: flex;margin-top: 2%">
                    <div class="fontHeight">{{'解析:'}}</div>
                    <div v-html="item.analyze" class="fontHeight"></div>
                  </div>

                  <div style="margin-top: 1%;height: 20px;line-height: 20px">{{'分数:' + item.score}}</div>
                  <div style="margin-top: 1%;height: 20px;line-height: 20px">{{'答案:' + item.correctArray}}</div>
                </div>
              </div>
            </div>

            <!-- 填空题渲染 -->
            <div class="right_container_body_pack">
              <div class="right_container_body_choice_div1">
                <span style="font-size: 20px">填空题</span>
                <el-button type="text" class="addQuestion" @click="addPack">添加题目</el-button>
              </div>
              <div class="right_container_body_choice_div2">
                <div v-for="(item,index) in form.pack" :key="index" style="padding-top: 3%">
                  <div style="display: flex">
                    <div class="right_container_body_choice_div5">{{(index + 1) + '.'}}</div>
                    <div v-html="item.title" class="right_container_body_choice_div5"></div>
                    <el-button type="text" class="right_container_body_choice_set" @click="handleChoiceSet(item.id)">设置分数</el-button>
                    <el-button type="text" class="right_container_body_choice_delete" @click="deletePack(index)">删除
                    </el-button>

                  </div>

                  <div style="margin-left: 2%;padding-bottom: 1%;margin-top: 2%;width: 100%;display: flex;">
                    <div v-for="(it,ide) in item.items" :key="ide" style="width: 25%;display: flex">
                      <span class="fontHeight">{{it.prefix+'.'}}</span><span v-html="it.content"
                                                                             class="fontHeight"></span>
                    </div>
                  </div>

                  <div style="display: flex;margin-top: 2%">
                    <div class="fontHeight">{{'解析:'}}</div>
                    <div v-html="item.analyze" class="fontHeight"></div>
                  </div>

                  <div style="margin-top: 1%;height: 20px;line-height: 20px">{{'分数:' + item.score}}</div>

                  <div style="margin-top: 1%;display: flex">
                    <div class="fontHeight">{{'答案:'}}</div>
                    <div v-html="item.correctArray" class="fontHeight"></div>
                  </div>
                </div>
              </div>
            </div>

            <!-- 简答题渲染 -->
            <div class="right_container_body_bigQuestion">
              <div class="right_container_body_choice_div1">
                <span style="font-size: 20px">简答题</span>
                <el-button type="text" class="addQuestion" @click="addBigQuestions">添加题目</el-button>
              </div>
              <div class="right_container_body_choice_div2">
                <div v-for="(item,index) in form.bigQuestions" :key="index" style="padding-top: 3%">
                  <div style="display: flex">
                    <div class="right_container_body_choice_div5">{{(index + 1) + '.'}}</div>
                    <div v-html="item.title" class="right_container_body_choice_div5"></div>
                    <el-button type="text" class="right_container_body_choice_set" @click="handleChoiceSet(item.id)">设置分数</el-button>
                    <el-button type="text" class="right_container_body_choice_delete" @click="deleteBigQuestion(index)">
                      删除
                    </el-button>
                  </div>

                  <div style="display: flex;margin-top: 2%">
                    <div class="fontHeight">{{'解析:'}}</div>
                    <div v-html="item.analyze" class="fontHeight"></div>
                  </div>

                  <div style="margin-top: 1%;height: 20px;line-height: 20px">{{'分数:' + item.score}}</div>

                  <div style="margin-top: 1%;display: flex">
                    <div class="fontHeight">{{'答案:'}}</div>
                    <div v-html="item.correctArray" class="fontHeight"></div>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <div class="right_container_foot">
            <el-row>
              <el-col :span="8">
                <el-button type="primary" @click="submitEditPaper">修改</el-button>
              </el-col>
              <el-col :span="8">
                <el-button @click="cancel">取消</el-button>
              </el-col>

            </el-row>
          </div>
        </div>
      </el-scrollbar>
    </el-dialog>

    <!-- 修改分数弹出框 -->
    <el-dialog title="修改单选题分数" :visible.sync="updateScoreVisible" width="30%" >
        <el-form label-width="100px">
          <el-row>
            <el-col :xs="20" :sm="20" :md="20" :lg="20">
              <el-form-item label="分数：">
                <el-input v-model="num"/>
              </el-form-item>
            </el-col>
          </el-row>

          <el-form-item class="buttons" >
            <el-row>
              <el-col :xs="12" :sm="12" :md="12" :lg="12">
                <el-button type="primary" @click="submitUpdateScore">提交</el-button>
              </el-col>
              <el-col :xs="12" :sm="12" :md="12" :lg="12">
                <el-button @click="cancel">取消</el-button>
              </el-col>
            </el-row>
          </el-form-item>
        </el-form>
    </el-dialog>


    <!-- 添加选择题 -->
    <el-dialog title="添加选择题" :visible.sync="addSingleQuestionVisible" width="40%">


      <el-form :model="singleForm" ref="singleForm" label-width="100px" class="single-form">

        <el-row>
          <el-col  :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="题干：" prop="title"  >
              <el-input  v-model="singleForm.title"  />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :xs="18" :sm="18" :md="18" :lg="18">
            <el-form-item label="选项：" prop="items" class="items">
              <el-form-item  prop="content" :label="item.prefix" :key="item.prefix"  v-for="(item,index) in singleForm.items"  label-width="20px" class="question-item-label">
                <el-input   v-model="item.content"    class="question-item-content-input"/>
              </el-form-item>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="解析：" prop="analyze" class="analyze">
              <el-input  v-model="singleForm.analyze" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="分数：" prop="analyze" class="analyze">
              <el-input-number style="width: 40%" v-model="num" :min="1" :max="10"></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item class="correctArray" label="正确答案：" prop="correctArray" required>
          <el-radio-group v-model="singleForm.correctArray" style="margin-left: 2%">
            <el-radio  v-for="item in singleForm.items"  :key="item.prefix"  :label="item.prefix">{{item.prefix}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="buttons" >
          <el-row>
            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <el-button style="margin-left: 5%" type="primary" @click="submitSingleForm">提交</el-button>
            </el-col>
            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <el-button style="margin-left: 5%" @click="cancel">取消</el-button>
            </el-col>
            <el-col :xs="8" :sm="8" :md="8" :lg="8">
              <el-button type="text" size="medium"   @click="addQuestionFromList(1)">
                从题库中导入
              </el-button>
            </el-col>
          </el-row>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 添加多选题 -->
    <el-dialog title="添加多选题" :visible.sync="addMultipleQuestionVisible" width="40%">
      <el-form :model="multipleForm" ref="multipleForm" label-width="100px" class="single-form">

        <el-row>
          <el-col  :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="题干：" prop="title"  >
              <el-input  v-model="multipleForm.title"  />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :xs="18" :sm="18" :md="18" :lg="18">
            <el-form-item label="选项：" prop="items" class="items">
              <el-form-item  prop="content" :label="item.prefix" :key="item.prefix"  v-for="(item,index) in multipleForm.items"  label-width="20px" class="question-item-label">
                <el-input   v-model="item.content"    class="question-item-content-input"/>
                <!--
                              <el-button  type="danger" size="mini" class="question-item-remove" icon="el-icon-delete" @click="questionItemRemove(index)"></el-button>
                -->
              </el-form-item>
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="解析：" prop="analyze" class="analyze">
              <el-input v-model="multipleForm.analyze" />
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="分数：" prop="analyze" class="analyze">
              <el-input-number style="width: 40%" v-model="num" :min="1" :max="10"></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>

        <el-form-item class="correctArray" label="正确答案：" prop="correctArray" >
          <el-checkbox-group v-model="multipleForm.correctArray" style="margin-left: 2%">
            <el-checkbox v-for="item in multipleForm.items" :key="item.prefix" :label="item.prefix" >{{item.prefix}}</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
        <el-form-item class="buttons" >
          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button style="margin-left: 5%" type="primary" @click="submitMultipleForm">提交</el-button>
          </el-col>

          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button style="margin-left: 5%" @click="cancel">取消</el-button>
          </el-col>

          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button type="text" size="medium"   @click="addQuestionFromList(2)">
              从题库中导入
            </el-button>
          </el-col>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 添加判断题 -->
    <el-dialog title="添加判断题" :visible.sync="addJudgeQuestionVisible" width="40%">
      <el-form :model="judgeForm" ref="form" label-width="100px" class="single-form">

        <el-row>
          <el-col  :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="题干：" prop="title"  >
              <el-input  v-model="judgeForm.title"  />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :xs="18" :sm="18" :md="18" :lg="18">
            <el-form-item label="选项：" prop="items" class="items">
              <el-form-item  prop="content" :label="item.prefix" :key="item.prefix"  v-for="(item,index) in judgeForm.items"  label-width="20px" class="question-item-label">
                <el-input disabled v-model="item.content"    class="question-item-content-input"/>
                <!--
                              <el-button  type="danger" size="mini" class="question-item-remove" icon="el-icon-delete" @click="questionItemRemove(index)"></el-button>
                -->
              </el-form-item>
            </el-form-item>
          </el-col>

        </el-row>



        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="解析：" prop="analyze" class="analyze">
              <el-input  v-model="judgeForm.analyze" />
            </el-form-item>
          </el-col>

        </el-row>

        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="分数：" prop="analyze" class="analyze">
              <el-input-number style="width: 40%" v-model="num" :min="1" :max="10"></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>


        <el-form-item class="correctArray" label="正确答案：" prop="correctArray" required>
          <el-radio-group v-model="judgeForm.correctArray" style="margin-left: 2%">
            <el-radio  v-for="item in judgeForm.items"  :key="item.prefix"  :label="item.prefix">{{item.prefix}}</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="buttons" >
          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button style="margin-left: 5%" type="primary" @click="submitJudgeForm">提交</el-button>
          </el-col>
          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button style="margin-left: 5%" @click="cancel">取消</el-button>
          </el-col>
          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button type="text" size="medium"   @click="addQuestionFromList(3)">
              从题库中导入
            </el-button>
          </el-col>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 添加填空题 -->
    <el-dialog title="添加填空题" :visible.sync="addFillQuestionVisible" width="40%">
      <el-form :model="fillForm" ref="form" label-width="100px" class="single-form">

        <el-row>
          <el-col  :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="题干：" prop="title"  >
              <el-input type="textarea"   v-model="fillForm.title"  />
            </el-form-item>
          </el-col>
        </el-row>


        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="解析：" prop="analyze" class="analyze">
              <el-input  v-model="fillForm.analyze" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="分数：" prop="analyze" class="analyze">
              <el-input-number style="width: 40%" v-model="num" :min="1" :max="10"></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col  :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="正确答案：" prop="correctArray" class="analyze">
              <el-input type="textarea"  v-model="fillForm.correctArray" />
            </el-form-item>
          </el-col>
        </el-row>


        <el-form-item class="buttons" >
          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button style="margin-left: 5%" type="primary" @click="submitFillForm">提交</el-button>
          </el-col>

          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button style="margin-left: 5%" @click="cancel">取消</el-button>
          </el-col>

          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button type="text" size="medium"   @click="addQuestionFromList(4)">
              从题库中导入
            </el-button>
          </el-col>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 添加简答题 -->
    <el-dialog title="添加简答题" :visible.sync="addShotAnswerQuestionVisible" width="40%">
      <el-form :model="shotAnswerForm" ref="form" label-width="100px" class="single-form">

        <el-row>
          <el-col  :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="题干：" prop="title"  >
              <el-input type="textarea"   v-model="shotAnswerForm.title"  />
            </el-form-item>
          </el-col>
        </el-row>


        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="解析：" prop="analyze" class="analyze">
              <el-input type="textarea"  v-model="shotAnswerForm.analyze" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="分数：" prop="analyze" class="analyze">
              <el-input-number style="width: 40%" v-model="num" :min="1" :max="10"></el-input-number>
            </el-form-item>
          </el-col>
        </el-row>



        <el-row>
          <el-col  :xs="20" :sm="20" :md="20" :lg="20">
            <el-form-item label="正确答案：" prop="correctArray" class="analyze">
              <el-input type="textarea"  v-model="shotAnswerForm.correctArray" />
            </el-form-item>
          </el-col>
        </el-row>


        <el-form-item class="buttons" >
          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button style="margin-left: 5%" type="primary" @click="submitShotAnswerForm">提交</el-button>
          </el-col>

          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button style="margin-left: 5%" @click="cancel">取消</el-button>
          </el-col>

          <el-col :xs="8" :sm="8" :md="8" :lg="8">
            <el-button type="text" size="medium"   @click="addQuestionFromList(5)">
              从题库中导入
            </el-button>
          </el-col>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 从题库选择题目弹出框 -->
    <el-dialog title="从题库导入" :visible.sync="questionPage.showDialog"  width="70%">
      <el-form :model="questionPage.queryParam" ref="queryForm" :inline="true">
        <el-form-item label="ID：">
          <el-input v-model="questionPage.queryParam.questionId"  clearable></el-input>
        </el-form-item>
        <el-form-item label="题型：">
          <el-select v-model="questionPage.queryParam.type">
            <el-option v-for="(item,index) in questionTypeEnum" :key="index" :value="item.type" :label="item.type"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="queryForm">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table :data="questionTableData"
                @selection-change="handleQuestionSelectionChange" border fit highlight-current-row style="width: 100%" :row-key="getRowKey">
        <el-table-column type="selection" align="center" min-width="80" :reserve-selection="true"></el-table-column>
        <el-table-column prop="questionId" label="题目编号" min-width="50"/>
        <el-table-column prop="type" label="题目类型" min-width="80"/>
        <el-table-column prop="title" label="题干" min-width="250"/>
        <el-table-column prop="correctArray" label="答案" min-width="50"/>
        <el-table-column label="默认分值" width="80" prop="score"></el-table-column>

      </el-table>
      <div class="pagination">
        <el-pagination background layout="total, prev, pager, next" :current-page="queryQuestion.currentPage"
                       :page-size="queryQuestion.pageSize" :total="queryQuestion.total" @current-change="handleQuestionChange"/>
      </div>
      <span slot="footer" class="dialog-footer">
          <el-button @click="questionPage.showDialog = false">取 消</el-button>
          <el-button type="primary" @click="confirmQuestionSelect">确定</el-button>
     </span>
    </el-dialog>

    <!-- 错误名单 -->
    <el-dialog title="错误名单" :visible.sync="errorVisible"  width="70%">

      <div>
        <span>以下用户导入失败!</span>
        <div>
          {{errorContent}}
        </div>
      </div>

      <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="this.errorVisible === false">确定</el-button>
     </span>
    </el-dialog>


    <!-- 拉人入伙弹出框 -->
    <el-dialog title="选定考试人员" :visible.sync="addUserVisible" width="60%">
      <div class="handle-box">

        <el-row>



          <el-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4">
            <el-button  class="downButton" type="primary"icon="el-icon-search" @click="download">下载模板</el-button>
          </el-col>
          <el-col :xs="4" :sm="4" :md="4" :lg="4" :xl="4">
            <el-upload class="uploadExcel" action="http://211.69.16.108:9001/pageUser/uploadExcel" :on-success="uploadSuccess" :on-error="uploadError"
            >
              <el-button type="primary" icon="el-icon-s-promotion">导入考试名单
              </el-button>
            </el-upload>
          </el-col>
        </el-row>

      </div>
      <el-table :data="this.userTableData"  border class="table" ref="multipleTable" header-cell-class-name="table-header"
                @selection-change="handleUserSelectionChange" highlight-current-row>
        <el-table-column  type="selection" align="center"/>
        <el-table-column prop="userId" label="学号/工号" min-width="80" align="center"/>
        <el-table-column prop="name" label="姓名" min-width="80"/>
        <el-table-column  label="性别" min-width="80">
          <template slot-scope="scope">
            {{formatSex(scope.row.sex)}}
          </template>
        </el-table-column>
        <el-table-column  label="班级" min-width="80">
          <template slot-scope="scope">
            {{scope.row.clazz === undefined ? '暂无': scope.row.clazz.name}}
          </template>
        </el-table-column>

      </el-table>
      <div class="pagination">
        <el-pagination background layout="total, prev, pager, next" :current-page="queryUser.currentPage"
                       :page-size="queryUser.pageSize" :total="queryUser.total" @current-change="handleUserChange"/>
      </div>

      <el-row style="margin-left: 30%">
        <el-col :span="8">
          <el-button  type="primary" @click="confirmUserSelect">确定</el-button>
        </el-col>
        <el-col :span="8">
          <el-button type="info" @click="cancel">取消</el-button>
        </el-col>
      </el-row>
    </el-dialog>


  </div>
</div>
</template>

<script>
  import exam from '../../../utils/exam'
  import question from '../../../utils/question'
  import info from '../../../utils/info'
  import {
    queryExamPageAnswer,
    queryExamPageByPage,
    queryQuestionPage,
    queryUsers,
    updateExamPage, userJoinExam
  } from '../../../api';
  export default {
    name: 'ExamList',
    data() {
      return {
        /* 计时器 */
        nowTime: new Date(),
        /* 计数器 */
        num: 0,
        /* 标识 */
        index: 0,
        type: 0,

        /* 考试人员id */
        examUserList: [],

        examKeyWord: '',
        questionKeyWord: '',
        userKeyWord: '',
        /* 分页 */
        queryExam: {
          total: 10,
          pageSize: 7,
          currentPage: 1,
        },
        queryQuestion: {
          total: 10,
          pageSize: 7,
          currentPage: 1,
        },
        queryUser: {

          total: 10,
          pageSize: 7,
          currentPage: 1

        },
        tableData: [],
        questionTableData: [],
        userTableData: [],
        formLabelWidth: '30%',

        questionPage: {
          multipleQuestionSelection: [],
          multipleUserSelection: [],
          showDialog: false,
          queryParam: {
            questionId: null,
            type: null,
          },
          tableData: [],
        },

        /* 试卷表单 */
        form: {
          examPageId: null,
          examPageName: null,
          createTime: null,
          startTime: 0,
          endTime: 0,
          adviceTime: 0,
          choice: [],
          multChoices:[],
          judge:[],
          pack: [],
          bigQuestions:[],
        },

        addUserVisible: false,
        updateScoreVisible: false,
        editPaperVisible: false,

        /* 添加单选题 */
        addSingleQuestionVisible: false,
        /* 添加多选题 */
        addMultipleQuestionVisible: false,
        /* 添加判断题 */
        addJudgeQuestionVisible: false,
        /* 添加填空题 */
        addFillQuestionVisible: false,
        /* 添加简答题 */
        addShotAnswerQuestionVisible: false,

        /* 错误名单 */
        errorVisible: false,

        /* 错误内容 */
        errorContent: false,

        /* 富文本 */
        editorId: 0,
        editorVisible: false,
        content: '',
        editorOption: {
          placeholder: 'Hello World'
        },

        /* 单选框 */
        singleForm: {
          id: null,
          questionType: 1,
          title: '',
          items: [
            { prefix: 'A', content: '' },
            { prefix: 'B', content: '' },
            { prefix: 'C', content: '' },
            { prefix: 'D', content: '' }
          ],
          score: 0,
          analyze: '',
          correctArray: '',
        },
        /* 多选框 */
        multipleForm: {
          id: null,
          questionType: 1,
          title: '',
          items: [
            { prefix: 'A', content: '' },
            { prefix: 'B', content: '' },
            { prefix: 'C', content: '' },
            { prefix: 'D', content: '' }
          ],
          analyze: '',
          correctArray: [],
          score: 0,
        },
        /* 判断框 */
        judgeForm: {
          id: null,
          questionType: 1,
          title: '',
          items: [
            { prefix: 'A', content: '是' },
            { prefix: 'B', content: '否' },
          ],
          analyze: '',
          correctArray: '',
          score: 0,
        },
        /* 填空框 */
        fillForm: {
          id: null,
          questionType: 1,
          title: '',
          items: [],
          analyze: '',
          correctArray: '',
          score: 0,
        },
        /* 简答框 */
        shotAnswerForm: {
          id: null,
          questionType: 1,
          title: '',
          items: [

          ],
          analyze: '',
          correctArray: '',
          score: 0,
        },

        /* 题目类型 */
        questionTypeEnum: [],
        examId: '',
        deleteArray: []
      }
    },
    mounted(){
      this.getData();
    },
    activated: function() {
      this.getData();
    },

    created() {
      this.getData();
       let that = this;
       setInterval(function() {
         that.nowTime = new Date();
       },3000);
    },
    methods: {
      // 获取 easy-mock 的模拟数据
      async getData() {




        let current = this.queryExam.currentPage;
        let size = this.queryExam.pageSize;


        const data = await queryExamPageByPage({current:current,size:size});
        console.log(data);

        this.tableData = data.records;
        this.queryExam.total = data.total;


        this.questionTableData = question.questions;
        this.queryQuestion.total = question.questions.length;
        this.userTableData = info.list;
        this.queryUser.total = info.list.length;

        this.questionTypeEnum = question.questionTypes;
      },
      /* 查询类型 */
      queryForm(){

      },
      getRowKey(row){
        return row.questionId;
      },
      // 触发搜索按钮
      async handleSearch(userKeyWord) {

        let current = this.queryUser.currentPage;
        let size = this.queryUser.pageSize;
        let name = userKeyWord;

        const data =  await queryUsers({ name, current, size })

        this.userTableData = data.records;
        // 发送查询请求,查询内容为keyWord
        // 获取返回数据然后渲染表格
      },

      //下载
      download(){
        this.$axios.request({
          url: '/pageUser/download',
          method: 'get',
          responseType: 'blob',
        }).then(res => {
          const data = res.data;
          let url = window.URL.createObjectURL(data);
          let a = document.createElement('a');
          document.body.appendChild(a);
          a.href = url;
          a.download = '用户模板.xlsx';
          a.click();
          window.URL.revokeObjectURL(url);
        })
      },

      //上传
      uploadSuccess(res){
        console.log(res);

        //todo 弹出导入成功和失败的用户!
        let error = res.data.map.error;

        if (error.length !== 0){
          let str = '';
          for(let i = 0;i < error.length;i++){
            str += error[i] + ",";
          }
/*
          this.$message.error("本次以下用户没有导入成功!  "+ str)
*/

          this.errorContent = str;
          this.errorVisible = true;

        }else{
          this.$message.success("导入成功!");
        }



      },
      uploadError(res){
        console.log(res);
        this.$message.success("导入失败!");
      },


      // 分页导航
      async handleExamChange(val) {
        /* 更换当前页 */

        let size = this.queryExam.pageSize;
        this.queryExam.currentPage = val;


        const data = await queryExamPageByPage({ current: val, size: size });
        console.log(data);

        this.tableData = data.records;

      },
      async handleQuestionChange(val) {

        let type = this.type;
        console.log(type);
        let size = this.queryQuestion.pageSize;
        this.queryExam.currentPage = val;
        const response = await queryQuestionPage({ type: type, current: val, size: size });
        console.log(response);
        this.questionTableData = response.records;

      },
      async handleUserChange(val) {
        /* 更换当前页 */
        this.$set(this.queryUser, 'currentPage', val);
        /*this.getData();*/

        let current = val;
        let size = this.queryUser.pageSize;
        const data =  await queryUsers({ current, size });


        this.userTableData = data.records;
        console.log(this.userTableData);
        this.queryUser.total = data.total;
      },
      // 标签格式化
      statusTagFormat(row){

        let startTime = new Date(row.startTime);
        let endTime = new Date(row.endTime);

        if( this.nowTime.getTime() < startTime.getTime() ){
          // 考试未开始
          return 'info';
        }else if(this.nowTime.getTime() >= startTime.getTime() && this.nowTime.getTime() < endTime.getTime()){
          // 考试正在进行
          return 'success';
        }else{
          // 考试已结束
          return 'danger';
        }
      },
      // 文字格式化
      statusFormat(row){
        let startTime = new Date(row.startTime);
        let endTime = new Date(row.endTime);

        if( this.nowTime.getTime() < startTime.getTime() ){
          // 考试未开始
          return '未开始';
        }else if(this.nowTime.getTime() >= startTime.getTime() && this.nowTime.getTime() < endTime.getTime()){
          // 考试正在进行
          return '进行中';
        }else{
          // 考试已结束
          return '已结束';
        }
      },
      //根据时间禁用相应操作
      test(row){
        let startTime = new Date(row.startTime);
        let endTime = new Date(row.endTime);
        let nowTime = new Date();

        if( nowTime.getTime() < startTime.getTime() ){
          // 考试未开始
          return 0;
        }else if(nowTime.getTime() >= startTime.getTime() && nowTime.getTime() < endTime.getTime()){
          // 考试正在进行
          return 1;
        }else{
          // 考试已结束
          return 2;
        }
      },
      // 计算总分
      getTotal(){
        let sum = 0;
        for(let i = 0;i < this.form.choice.length;i++){
          sum += parseInt(this.form.choice[i].score);
        }
        for(let i = 0;i < this.form.multChoices.length;i++){
          sum += parseInt(this.form.multChoices[i].score);
        }
        for(let i = 0;i < this.form.judge.length;i++){
          sum += parseInt(this.form.judge[i].score);
        }
        for(let i = 0;i < this.form.pack.length;i++){
          sum += parseInt(this.form.pack[i].score);
        }
        for(let i = 0;i < this.form.bigQuestions.length;i++){
          sum += parseInt(this.form.bigQuestions[i].score);
        }

        return sum;
      },

      /* 编辑试卷 */
      async editPaper(id) {
        console.log(id);
        /* 发送请求,根据id查询出试卷*/

        const data =  await queryExamPageAnswer({ id });
        console.log(data);

        //todo
        this.form.adviceTime = data.examPage.adviceTime;
        this.form.bigQuestions = data.examPage.bigQuestions;
        this.form.choice = data.examPage.choice;
        this.form.createTime = data.examPage.createTime;
        this.form.endTime = data.examPage.endTime;
        this.form.examPageId = data.examPage.exampageId;
        this.form.examPageName = data.examPage.exampageName;
        this.form.judge = data.examPage.judge;
        this.form.multChoices = data.examPage.multChoices;
        this.form.pack = data.examPage.pack;
        this.form.startTime = data.examPage.startTime;
        this.editPaperVisible = true;
      },

      /* 拉人入伙 */
      async addUser(id) {

        let exampageId = id;
        this.examId = id;


        //查询 用户
        let current = this.queryUser.currentPage;
        let size = this.queryUser.pageSize;
        const data =  await queryUsers({ current, size });


        this.userTableData = data.records;
        console.log(this.userTableData);
        this.queryUser.total = data.total;


        this.addUserVisible = true;
      },

      formatSex(sex){
        return sex === '1' ? '男': '女';
      },


      /* 修改分数 */
      handleChoiceSet(id){
        this.updateScoreVisible = true;
        console.log(id);
        this.index = id;
      },

      /* 删除单选题题目 */
      deleteChoice(id){

        // 遍历choice,删除
        let newChoice = [];
        let j = 0;
        for (let i = 0; i < this.form.choice.length; i++) {
          if (!(id === i)) {
            newChoice[j] = this.form.choice[i];
            j++;
          }
        }
        console.log(newChoice);
        this.form.choice = newChoice;
      },

      /* 删除多选题 */
      deleteMutiChoices(id) {
        // 遍历choice,删除
        console.log(id);
        let newChoice = [];
        let j = 0;
        for (let i = 0; i < this.form.multChoices.length; i++) {
          if (!(id === i)) {
            newChoice[j] = this.form.multChoices[i];
            j++;
          }
        }
        console.log(newChoice);
        this.form.multChoices = newChoice;
      },

      /* 删除判断题 */
      deleteJudge(id) {
        // 遍历choice,删除
        console.log(id);
        let newChoice = [];
        let j = 0;
        for (let i = 0; i < this.form.judge.length; i++) {
          if (!(id === i)) {
            newChoice[j] = this.form.judge[i];
            j++;
          }
        }
        console.log(newChoice);
        this.form.judge = newChoice;
      },

      /* 删除填空题 */
      deletePack(id) {
        // 遍历choice,删除
        console.log(id);
        let newChoice = [];
        let j = 0;
        for (let i = 0; i < this.form.pack.length; i++) {
          if (!(id === i)) {
            newChoice[j] = this.form.pack[i];
            j++;
          }
        }
        console.log(newChoice);
        this.form.pack = newChoice;
      },

      /* 删除简答题 */
      deleteBigQuestion(id) {
        // 遍历choice,删除
        console.log(id);
        let newChoice = [];
        let j = 0;
        for (let i = 0; i < this.form.bigQuestions.length; i++) {
          if (!(id === i)) {
            newChoice[j] = this.form.bigQuestions[i];
            j++;
          }
        }
        console.log(newChoice);
        this.form.bigQuestions = newChoice;
      },

      /* 单选框显示 */
      addChoice(){
        this.addSingleQuestionVisible = true;
      },
      /* 单选框确认 */
      submitSingleForm(){
        this.singleForm.score = this.num;
        let singleQuestion = {
          "title": this.singleForm.title,
          "analyze": this.singleForm.analyze,
          "items": this.singleForm.items,
          "score": this.singleForm.score,
          "correctArray": this.singleForm.correctArray
        }
        this.form.choice.push(singleQuestion);
        this.addSingleQuestionVisible = false;
      },
      /* 多选框显示 */
      addMultChoices(){
        this.addMultipleQuestionVisible = true;
      },
      /* 多选框确认 */
      submitMultipleForm(){
        this.multipleForm.score = this.num;
        let multipleQuestion = {
          "title": this.multipleForm.title,
          "analyze": this.multipleForm.analyze,
          "items": this.multipleForm.items,
          "score": this.multipleForm.score,
          "correctArray": this.multipleForm.correctArray
        }
        this.form.multChoices.push(multipleQuestion);
        this.addMultipleQuestionVisible = false;
      },

      /* 判断框显示 */
      addJudge(){
        this.addJudgeQuestionVisible = true;
      },
      /* 判断空确认 */
      submitJudgeForm(){
        this.judgeForm.score = this.num;
        let judgeQuestion = {
          "title": this.judgeForm.title,
          "analyze": this.judgeForm.analyze,
          "items": this.judgeForm.items,
          "score": this.judgeForm.score,
          "correctArray": this.judgeForm.correctArray
        }
        this.form.judge.push(judgeQuestion);
        this.addJudgeQuestionVisible = false;
      },

      /* 填空框显示 */
      addPack(){
        this.addFillQuestionVisible = true;
      },
      /* 提交填空表单 */
      submitFillForm(){
        this.fillForm.score = this.num;
        let fillQuestion = {
          "title": this.fillForm.title,
          "analyze": this.fillForm.analyze,
          "items": this.fillForm.items,
          "score": this.fillForm.score,
          "correctArray": this.fillForm.correctArray
        }
        this.form.pack.push(fillQuestion);
        this.addFillQuestionVisible = false;
      },

      /* 简答框显示 */
      addBigQuestions(){
        this.addShotAnswerQuestionVisible = true;
      },
      /* 简答框确认 */
      submitShotAnswerForm(){
        this.shotAnswerForm.score = this.num;
        let shotAnswerQuestion = {
          "title": this.shotAnswerForm.title,
          "analyze": this.shotAnswerForm.analyze,
          "items": this.shotAnswerForm.items,
          "score": this.shotAnswerForm.score,
          "correctArray": this.shotAnswerForm.correctArray
        }
        this.form.bigQuestions.push(shotAnswerQuestion);
        this.addShotAnswerQuestionVisible = false;
      },


      /* 从题库中导入题目 */
      async addQuestionFromList(index) {

        this.type = index;
        let current = this.queryQuestion.currentPage;
        let size = this.queryQuestion.pageSize;

        const response = await queryQuestionPage({ type: index, current: current, size: size });
        console.log(response);
        this.questionTableData = response.records;
        this.queryQuestion.total = response.total;

        switch (index) {
          case 1:
            this.addSingleQuestionVisible = false;
            break;
          case 2:
            this.addMultipleQuestionVisible = false;
            break;
          case 3:
            this.addJudgeQuestionVisible = false;
            break;
          case 4:
            this.addFillQuestionVisible = false;
            break;
          case 5:
            this.addShotAnswerQuestionVisible = false;
            break;
        }
        /* 这里可以通过不同的名字,来筛选题库 */
        this.questionPage.showDialog = true
      },
      /* 多选 题目 */
      handleQuestionSelectionChange (val) {
        this.questionPage.multipleQuestionSelection = val
      },
      /*多选 题目 确认*/
      confirmQuestionSelect () {
        for(let i = 0;i < this.questionPage.multipleQuestionSelection.length;i++){
          switch (this.questionPage.multipleQuestionSelection[i].type) {
            case 1:
              this.form.choice.push(this.questionPage.multipleQuestionSelection[i]);
              break;
            case 2:
              this.form.multChoices.push(this.questionPage.multipleQuestionSelection[i]);
              break;
            case 3:
              this.form.judge.push(this.questionPage.multipleQuestionSelection[i]);
              break;
            case 4:
              this.form.pack.push(this.questionPage.multipleQuestionSelection[i]);
              break;
            case 5:
              this.form.bigQuestions.push(this.questionPage.multipleQuestionSelection[i]);
              break;
            default:
              break;
          }
        }

        this.questionPage.showDialog = false
      },
      /* 多选 人员 */
      handleUserSelectionChange(val){
        this.questionPage.multipleUserSelection = val;
      },
      /* 多选 人员 确认 */
      async confirmUserSelect() {
        for (let i = 0; i < this.questionPage.multipleUserSelection.length; i++) {
          let s = this.questionPage.multipleUserSelection[i].userId;
          this.examUserList.push(s);
        }
        /* 手动添加用户id */
        console.log(this.examUserList);





        //发送考试用户id
        let users = this.examUserList;

        this.$axios.post('/answer/userJoinExam?examId=' + this.examId,users).then(res=>{
          this.$message.success("添加成功!");
          this.addUserVisible = false;
          this.getData();
        }).catch(res=>{
          this.$message.error("添加失败!");
          this.addUserVisible = false;
          this.getData();
        });


      },

      /* 分数监听框 */
      handleScore(id,scores){
        let score = parseInt(scores);
        for(let i = 0;i < this.questionPage.multipleQuestionSelection.length;i++){
          if(this.questionPage.multipleQuestionSelection[i].questionId === id){
            this.questionPage.multipleQuestionSelection[i].score = score;
          }
        }
      },


      /* 提交修改分数 */
      submitUpdateScore(){
        let index = this.index;
        console.log(index);
        for(let i = 0;i < this.form.choice.length;i++){
          if(this.form.choice[i].id === index){
            this.form.choice[i].score = this.num + '';
            break;
          }
        }

        for(let i = 0;i < this.form.multChoices.length;i++){
          if(this.form.multChoices[i].id === index){
            this.form.multChoices[i].score = this.num + '';
            break;
          }
        }

        for(let i = 0;i < this.form.judge.length;i++){
          if(this.form.judge[i].id === index){
            this.form.judge[i].score = this.num + '';
            break;
          }
        }

        for(let i = 0;i < this.form.pack.length;i++){
          if(this.form.pack[i].id === index){
            this.form.pack[i].score = this.num + '';
            break;
          }
        }

        for(let i = 0;i < this.form.bigQuestions.length;i++){
          if(this.form.bigQuestions[i].id === index){
            this.form.bigQuestions[i].score = this.num + '';
            break;
          }
        }

        this.$message.success("修改分数成功!");
        this.updateScoreVisible = false;
      },

      examInfo(row){
        let status = '';
        let startTime = new Date(row.startTime);
        let endTime = new Date(row.endTime);

        if( this.nowTime.getTime() < startTime.getTime() ){
          // 考试未开始
          status = '0';
        }else if(this.nowTime.getTime() >= startTime.getTime() && this.nowTime.getTime() < endTime.getTime()){
          // 考试正在进行
          status = '1';
        }else{
          // 考试已结束
          status = '2';
        }

        if(status === '0' || status === '1'){
          this.$router.push({path:'/examInfo',query:{id:row.exampageId,status:status}});
        }else{
          this.$router.push({path:'/examInfoEnd',query:{id:row.exampageId,status:status}});
        }
      },

      deleteExam(id){
        console.log(id);
      this.$confirm('确定删除该场考试吗 ?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
                .then(() => {
                  let array = [];
                  let ids = {
                    "id": id
                  };
                  array.push(ids);
                  this.deleteArray = array;
                  console.log(this.deleteArray);
                  this.$axios.delete('/exampage',{data:this.deleteArray})
                          .then((res)=>{
                            this.$message.success("删除成功!");
                            console.log(this.queryExam.currentPage);
                            this.getData();
                          })
                          .catch((res)=>{
                            this.$message.error("删除失败!");
                          })
                })
                .catch(() => {
                })
      },

      /* 提交修改试卷 */
      async submitEditPaper() {

        console.log(this.form);

        let exampageId = this.form.examPageId;
        let exampageName = this.form.examPageName;
        let createTime = this.form.createTime;
        let startTime = new Date(this.form.startTime).getTime();
        let endTime = new Date(this.form.endTime).getTime();
        let adviceTime = this.form.adviceTime;
        let choice = this.form.choice;
        let multChoices = this.form.multChoices;
        let judge = this.form.judge;
        let pack = this.form.pack;
        let bigQuestions = this.form.bigQuestions;

        // 发送请求
        await updateExamPage({ exampageId, exampageName, createTime, startTime, endTime, adviceTime, choice, multChoices, judge, pack, bigQuestions });

        this.$message.success("编辑试卷成功!");
        this.editPaperVisible = false;
      },

      //取消
      cancel(){
        this.updateScoreVisible = false;
        this.editPaperVisible = false;
        this.addUserVisible = false;
      },

      /* 导入考试人员名单 */
      onUploadChange(){

      }

    },

    watch: {
      updateScoreVisible(){
        if(this.updateScoreVisible === false){
          this.num = 0;
        }
      },
      editorVisible() {
        if (this.editorVisible === false) {
          this.content = '';
        }
      },
      addSingleQuestionVisible(){
        let singleForm = {
          id: null,
          questionType: 1,
          title: '',
          items: [
            { prefix: 'A', content: '' },
            { prefix: 'B', content: '' },
            { prefix: 'C', content: '' },
            { prefix: 'D', content: '' }
          ],
          score: 0,
          analyze: '',
          correctArray: '',
        };
        if(this.addSingleQuestionVisible === false){
          this.singleForm = singleForm;
        }
      },
      addMultipleQuestionVisible(){
        let multipleForm = {
          id: null,
          questionType: 1,
          title: '',
          items: [
            { prefix: 'A', content: '' },
            { prefix: 'B', content: '' },
            { prefix: 'C', content: '' },
            { prefix: 'D', content: '' }
          ],
          analyze: '',
          correctArray: [],
          score: 0,
        };
        if(this.addMultipleQuestionVisible === false){
          this.multipleForm = multipleForm;
        }
      },
      addJudgeQuestionVisible(){
        let judgeForm = {
          id: null,
          questionType: 1,
          title: '',
          items: [
            { prefix: 'A', content: '是' },
            { prefix: 'B', content: '否' },
          ],
          analyze: '',
          correctArray: '',
          score: 0,
        };
        if(this.addJudgeQuestionVisible === false){
          this.judgeForm = judgeForm;
        }
      },
      addShotAnswerQuestionVisible(){
        let shotAnswerForm = {
          id: null,
          questionType: 1,
          title: '',
          items: [

          ],
          analyze: '',
          correctArray: '',
          score: 0,
        };
        if(this.addShotAnswerQuestionVisible === false){
          this.shotAnswerForm = shotAnswerForm;
        }
      },

      nowTime(newVal,oldVal){

      },
      tableData(){
        /*this.getData();*/
      },
    }
  };
</script>

<style scoped>
  .handle-box {
    margin-bottom: 20px;
  }

  .handle-input {
    width: 300px;
    display: inline-block;
  }

  .table {
    width: 100%;
    font-size: 14px;
  }


  .mr10 {
    margin-right: 10px;
  }

  .searchButton{
    margin-left: 20%;
  }

  .downButton{
    margin-left: 40%;
  }

  /* 按钮大小 */
  .editButton,.deleteButton{
    font-size: 14px;
  }

  .exam_create{
    margin-left: 90%;
  }

  .red {
    color: #ff0000;
  }

  .searchButton{
    margin-left: 70%;
  }



  /* container */
  .app_container{
    width: 100%;
  }

  .container_header{
    margin: 2% auto;
    width: 100%;
    text-align: center;
  }

  .right_container_header_div1 {
    font-size: 20px;
  }

  .right_container_header_div2 {
    margin-top: 2%;
  }

  .right_container_header_div3 {
    margin-top: 1%;
  }

  .right_container_body_choice_div1 {
    margin-top: 1%;
  }

  .right_container_body_choice_div2 {
    margin-left: 3%;
  }

  .right_container_body_choice_div3 {
    padding-top: 3%;
  }

  .right_container_body_choice_div4 {
    display: flex;
  }

  .right_container_body_choice_div5 {
    height: 20px;
    line-height: 20px;
    align-self: center;
  }

  .right_container_body_choice_div6 {
    height: 20px;
    line-height: 20px;
    align-self: center;
  }

  .right_container_body_choice_set {
    margin-left: 10%;
    font-size: 16px;
    text-decoration: underline;
  }

  .right_container_body_choice_delete {
    margin-left: 10%;
    font-size: 16px;
    color: red;
    text-decoration: underline;
  }

  .right_container_body_choice_div7 {
    margin-left: 1%;
    padding-bottom: 1%;
    margin-top: 2%;
    width: 100%;
    display: flex;
  }

  .right_container_body_choice_div8 {
    width: 25%;
    display: flex;
  }

  .right_container_foot{
    margin-top: 5%;
    margin-left: 30%;
  }

  .fontHeight {
    height: 20px;
    line-height: 20px;
  }

  .addQuestion{
    margin-left: 10%;
    font-size: 16px;
    color: green;
    text-decoration: underline;
  }

  .searchButton{
    margin-left: 10%;
  }

  .searchLabel{
    width: 100%;
  }

  .searchButton{
    margin-left: 10%;
  }

</style>
